import request from "@/utils/request"

// 登录请求参数类型
type LoginParamsType = {
    userName: string;
    password: string;
    remember?: boolean
}
// 登录返回值类型
type LoginResponseType = {
    userName: string
}

// 登录接口
export function login(data: LoginParamsType) {
    return request.post<LoginResponseType>("/api/user/login", data)
}

// 学生搜索返回值类型
export type ListItem = {
    name: string;
    value: number;
}

// 学生搜索
export function selectByUserName(data: string) {
    const headers = {
        "content-type": "text/plain"
    }
    return request.post<ListItem[]>("/api/admin/user/selectByUserName", data, headers)
}

type SendType = {
    title: string,
    content: string,
    receiveUserIds: number[]
}

// 发送信息
export function messageSend(data: SendType) {
    return request.post<null>("/api/admin/message/send", data)
}